/*
 * CEnvironment.h
 *
 *  Created on: 11 Oct 2012
 *      Author: Mario Kleinsasser
 *		Time:	19:05:35
 */

#ifndef CENVIRONMENT_H_
#define CENVIRONMENT_H_

#include "CAreaList.h"
#include "CItemCreator.h"

using namespace std;

/* environment singelton implementation */

class CEnvironment {

private:
	/* singleton of environment */
	static CEnvironment* instance;

	/* the playground */
	CAreaList *playground;

	/* M and N size of playground */
	int M, N;

	/* game time cnt */
	int turncnt;

	CEnvironment(int M = 5, int N = 5);

	virtual ~CEnvironment();

public:
	/* init playground */
	void init(int M, int N);

	/* returns the reference */
	static CEnvironment &getInstance();

	/* returns the reference */
	static CEnvironment &getInstance(int M, int N);

	/* needed to destroy the object*/
	static void destroy();

	CAreaList* getPlayground() const {
		return playground;
	}

	/* act all method to call all act methods on all fields*/
	void actAll();

	void printAll();

	int getTurncnt() const {
		return turncnt;
	}

	void setTurncnt(int turncnt) {
		this->turncnt = turncnt;
	}

	/* Interface for N and M */
	int getM() const {
		return M;
	}

	void setM(int m) {
		M = m;
	}

	int getN() const {
		return N;
	}

	void setN(int n) {
		N = n;
	}
};

#endif /* CENVIRONMENT_H_ */
